Branchwell

Become a Pro / website · becomeapro.ai / src / app / api / auth / [...path] / route.ts

Raw 774 B on 807b8657974875ed44f307014cfbf8ce673dc5a6
1import { resourceAuth } from "@/lib/d1-auth";
2import { biolockRoute } from "@/lib/biolock/routes";
3
4export const dynamic = "force-dynamic";
5
6const BIOLOCK = "/api/auth/biolock/";
7
8export function GET(request: Request) {
9 const path = new URL(request.url).pathname;
10 if (path === "/api/auth/get-session") return resourceAuth().handler(request);
11 if (path === BIOLOCK + "devices") return biolockRoute(request, "devices");
12 return new Response(null, { status: 404 });
13}
14
15export function POST(request: Request) {
16 const path = new URL(request.url).pathname;
17 if (path === "/api/auth/sign-out") return resourceAuth().handler(request);
18 if (path.startsWith(BIOLOCK)) return biolockRoute(request, path.slice(BIOLOCK.length));
19 return new Response(null, { status: 404 });
20}